// pages/mine/feedback/feedback.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabShow: true,
    urlValue: "",
    feedValue: "",
    telValue: "",
    tips: true,
    tipsContent: "",
    feedLength: 0,
    sendSuccess: true,
    successBox:true,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let userInfo = wx.getStorageSync("userInfo")
    let openid = wx.getStorageSync('openid')
  },

  goWb() {
    wx.navigateTo({
      url: '/pages/webview/webview?path=https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzA4NzU2OTE2MQ==#wechat_redirect',
    })
  },

  urlInput(e) {
    this.setData({
      urlValue: e.detail.value
    })
  },
  feedInput(e) {
    this.setData({
      feedValue: e.detail.value,
      feedLength: e.detail.value.length
    })
  },
  telInput(e) {
    this.setData({
      telValue: e.detail.value
    })
  },

  send() {
    console.log(this.data.telValue)
    console.log(this.data.urlValue)
    console.log(this.data.feedValue)
    if (this.data.feedValue == "" || this.data.telValue == "") {
      this.setData({
        tipsContent: "请补充反馈内容或联系方式后再提交",
        tips: false
      })
      return
    } else if (this.data.feedValue.length < 10) {
      this.setData({
        tipsContent: "反馈描述不得少于10个字",
        tips: false
      })
      return
    }
    let data = {
      url: this.data.urlValue,
      feed_content: this.data.feedValue,
      tel: this.data.telValue,
    }
    // 提交的接口请求
    this.setData({
      sendSuccess: false,
      successBox: false
    })
  },
  /**
   * 开通微信提醒按钮
   */
  openNote(){
    this.setData({
      successBox:true
    })
  },
  /**
   * 关闭弹窗
   */
  closeMask(){
    this.setData({
      sendSuccess:true
    })
  },
  clearInput(){
    console.log(222)
  },

  closeTips() {
    this.setData({
      tips: true
    })
  },

  tabClick(e) {
    let num = e.currentTarget.dataset.num;
    if (num == 1) {
      console.log(2)
      this.setData({
        tabShow: true,
      })
    } else {
      this.setData({
        tabShow: false,
      })
    }
  }
})